package com.hq.fxh.No5_User.User.Activity;

import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.hq.fxh.No0_ChengQu.Activity.BaseActivity;
import com.hq.fxh.No5_User.User.Adapter.PAdapter_MyGZ;
import com.hq.fxh.No5_User.User.Fragment.Fragment_MyPlate_Plate;
import com.hq.fxh.No5_User.User.Fragment.Fragment_MyPlate_Video;
import com.hq.fxh.No6UerSpace.Fragment.Fragment_UserSpace_Plate;
import com.hq.fxh.No6UerSpace.Fragment.Fragment_UserSpace_Video;
import com.hq.fxh.R;
import com.hq.fxh.Utils.AppConstant;

import java.util.ArrayList;

import static android.R.attr.fragment;

public class MyPlate extends BaseActivity implements View.OnClickListener {

    protected TabLayout tabMyGuanZhu;
    protected ViewPager viewPagerMyGuanZhu;
    protected TabLayout tabMyPlate;
    protected ViewPager viewPagerMyPlate;
    protected ImageView toolbarImageBack;
    protected LinearLayout toolbarLayoutBack;
    protected TextView toolBarTvTitle;
    protected TextView toolBarTvMore;
    protected LinearLayout toolbarLayoutMore;
    private Fragment_MyPlate_Plate fragment_People;
    private Fragment_MyPlate_Video fragment_Plate;


    @Override
    protected int getLayoutId() {
        return R.layout.activity_my_plate;
    }

    @Override
    protected void initView() {

        tabMyGuanZhu = (TabLayout) findViewById(R.id.tab_MyPlate);
        viewPagerMyGuanZhu = (ViewPager) findViewById(R.id.viewPager_MyPlate);
        toolbarImageBack = (ImageView) findViewById(R.id.toolbar_image_back);
        toolbarLayoutBack = (LinearLayout) findViewById(R.id.toolbar_Layout_back);
        toolbarLayoutBack.setOnClickListener(MyPlate.this);
        toolBarTvTitle = (TextView) findViewById(R.id.toolBar_tv_Title);
        toolBarTvMore = (TextView) findViewById(R.id.toolBar_tv_More);
        toolbarLayoutMore = (LinearLayout) findViewById(R.id.toolbar_Layout_More);
    }

    @Override
    protected void initData() {
        toolBarTvMore.setVisibility(View.INVISIBLE);
        toolBarTvTitle.setText(AppConstant.wodetiezhi);
        toolBarTvMore.setVisibility(View.INVISIBLE);
        PAdapter_MyGZ adapter = new PAdapter_MyGZ(getSupportFragmentManager());
        ArrayList<Fragment> datas = new ArrayList<>();
        fragment_People = new Fragment_MyPlate_Plate();
        datas.add(fragment_People);
        fragment_Plate = new Fragment_MyPlate_Video();
        datas.add(fragment_Plate);
        adapter.setDatas(datas);
        viewPagerMyGuanZhu.setAdapter(adapter);
        viewPagerMyGuanZhu.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabMyGuanZhu));
        tabMyGuanZhu.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(viewPagerMyGuanZhu));
    }

    @Override
    public void onClick(View view) {
        if (view.getId() == R.id.toolbar_Layout_back) {
            finish();

        }
    }
}
